package com.project.controller;

import com.project.bean.EmployeeBean;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("room")
public class RoomController {
    @Autowired
    private IUserService service;

    @RequestMapping("add")
    public String add(HttpServletRequest req, HttpServletResponse resp){
        return "添加房间"+service.getUserName();
    }

    @RequestMapping("findAll")
    public List<EmployeeBean> findAll(){
        List<EmployeeBean> list = new ArrayList<>();
        list.add(new EmployeeBean(3,"刘三","18932039283",
                9000, LocalDate.parse("1998-09-30")));
        list.add(new EmployeeBean(4,"张勇","19382736243",
                9000, LocalDate.parse("1998-09-30")));
        list.add(new EmployeeBean(2,"何刊","13302938293",
                9000, LocalDate.parse("1998-09-30")));
        list.add(new EmployeeBean(1,"朱红","18839283742",
                9000, LocalDate.parse("1998-09-30")));

        return list;
    }
}
